package com.pbdemo.config;

import io.netty.buffer.ByteBuf;
import xyz.noark.core.util.UnsignedUtils;
import xyz.noark.network.codec.AbstractPacketCodec;
import xyz.noark.network.codec.protobuf.ProtobufLengthDecoder;

public class PbLengthDecoder extends ProtobufLengthDecoder {
    public PbLengthDecoder(AbstractPacketCodec packetCodec) {
        super(packetCodec);
    }

    @Override
    protected int readLength(ByteBuf in) {
        return UnsignedUtils.toUnsigned(in.readShort());
    }

}
